<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://www.layuicdn.com/layui-v2.5.7/css/layui.css">
</head>
<body>
  <form id="layer" class="layui-form" hidden>
    <div class="layui-col-md10" style="padding-top: 1rem">
        <div class="layui-form-item">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-block">
                <input name="name" type="text" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">语句</label>
            <div class="layui-input-block">
                <input name="phone" type="text" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-filter="sub_button" lay-submit="">提交</button>
                <button type="reset" class="layui-btn">重置</button>
            </div>
        </div>
    </div>
</form>

<script src="https://www.layuicdn.com/layui-v2.5.7/layui.js"></script>
<script src="http://cdn.bootcdn.net/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>
    layui.use(['layer', 'jquery', 'element', 'form'], function () {
        // let layer = layui.layer;
        //let form = layui.form
        var $ = layui.jquery, layer = layui.layer, element = layui.element, form = layui.form;
        form.on('submit(login_button)', function (data) {
            console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        $('#add_btn').click(function () {
            layer.open({
                type: 2,
				//content: 'static/templates/try/confirm.html',
                content: $('#layer'),
                area: '500px'
            })
        })
    })
</script>
</body>
</html>
